package com.yu.control.common;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "ServletAjaxDemo", value = "/ServletAjax")
public class ServletAjaxDemo extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取请求参数
        String idValue = request.getParameter("id");
        //业务逻辑处理
        //获取字符输出流
        PrintWriter writer = response.getWriter();
        //输出
        writer.write("hello 你好");
        //清空缓存区
        writer.flush();
    }
}
